package com.ss.android.video.renderview;

import android.view.SurfaceHolder;
import android.view.View;

import com.ss.android.video.MediaViewLayout;

import java.lang.ref.WeakReference;

public interface IRenderView {
    final class WindowVisibilityChangedListener {
        private WeakReference<MediaViewLayout> mMediaViewLayoutRef;

        public WindowVisibilityChangedListener(MediaViewLayout mediaViewLayout) {
            this.mMediaViewLayoutRef = new WeakReference(mediaViewLayout);
        }

        public final void onWindowVisibilityChanged(int visibility) {
            MediaViewLayout mediaViewLayout = this.mMediaViewLayoutRef.get();
            if (mediaViewLayout != null
                    && visibility != View.VISIBLE
                    && (mediaViewLayout.mVideoSurface.getView() == null || !mediaViewLayout.mVideoSurface.getView().isShown())) {
                mediaViewLayout.disableAutoRotate();
            }
        }
    }

    void setRenderCallback(IRenderCallback renderCallback);

    void resize(int width, int height);

    SurfaceHolder getHolder();

    View getView();

    void setVisibility(int visibility);

    void setWindowVisibilityChangedListener(WindowVisibilityChangedListener windowVisibilityChangedListener);
}

